  <?php $session->flash() ;?>
<div class="right_side_operate_area">
    <div class="right_side_title left">
        <h2><?php __('Change Password'); ?></h2>
    </div>
    <div class="right item_add_btn">
        <?php 
        $HTTP_REFERER=$_SERVER["HTTP_REFERER"];
        echo $html->link(__("Cancel",true),$HTTP_REFERER);?>
    </div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
      
        <?php 
            echo $form->create('User', array('action' => 'editpassword','type'=> 'post','id' => 'form','name' => 'form','onsubmit' => 'return checkpwd()') );
          //  var_dump($_SESSION);die;
           // echo $form->hidden('User.password',array('value'=>$_SESSION['pwd']));
        ?>
        <?php echo $form->hidden('User.id');?>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Old Password")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->password('User.OldPassword');?></div>
                <div id='oldpasswordmessage' class="error_message"></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("New Password")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->password('User.NewPassword');?></div>
                <div id='newpasswordmessage' class="error_message"></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"><?php __("Retype Password")?>：</div>
                <div class="form_right_e_input left"><?php echo $form->password('User.RetypePassword');?></div>
                <div id='retypepasswordmessage' class="error_message"></div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left"></div>
                <div class="form_add_submit left">
                    <?php echo $form->submit(__('Save',true), array("id"=>"editpassword","name"=>"submit","class"=>"buttom","div"=>false));  ?>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
function checkpwd(){
    if($("#UserOldPassword").val().trim() == ''){
        $("#oldpasswordmessage").html('请输入原始密码');
        return false;
      }
     // if($("#UserOldPassword").val().trim() != $("#UserPassword").val()){
    //  $("#oldpasswordmessage").html('您输入的原始密码错误');
    //    return false;
    //  }
      if($("#UserNewPassword").val().trim() == ''){
       $("#newpasswordmessage").html('请输入新密码');
            return false;
      }	
       if($("#UserNewPassword").val().length < 6){
        $("#newpasswordmessage").html('你的设置的密码至少为6位');
            return false;
       }
      if($("#UserNewPassword").val().length > 32){
        $("#newpasswordmessage").html('您的密码不能超过32位');
            return false;
       }
      if($("#UserRetypePassword").val().trim() == ''){
        $("#retypepasswordmessage").html('请输入确认密码');
            return false;
      }
       if($("#UserRetypePassword").val().trim() != $("#UserNewPassword").val().trim()){
        $("#retypepasswordmessage").html('您设置的密码不匹配');
            return false;
      }
      
}
</script>